-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Ariel Pacay
-- Create date: 18/11/2011 1:36 am (u.u)
-- Description:	Trae las compras con 
-- los parametros requeridos
-- =============================================
CREATE PROCEDURE GOOGLECODERS.PagoGet
	-- Add the parameters for the stored procedure here
	@FchDesde datetime,
	@FchHasta datetime,
	@IdBenef int
AS
BEGIN
	SELECT [IdCompra]
      ,[Monto]
      ,[Fecha]
      ,t.[IdTarjeta]
      ,p.[IdPostNet]
      ,[Modelo]
      ,[Marca]
      ,[Nombre]
      ,[Apellido]
  FROM [GD2C2011].[GOOGLECODERS].[Compra] co
JOIN [GD2C2011].[GOOGLECODERS].[Postnet] p ON co.IdPostnet = p.IdPostnet
JOIN [GD2C2011].[GOOGLECODERS].[Tarjetas] t ON t.IdTarjeta = co.IdTarjeta
JOIN [GD2C2011].[GOOGLECODERS].[Clientes] cl ON cl.IdCliente = t.IdCliente
WHERE (co.Fecha BETWEEN @FchDesde AND @FchHasta)
	AND (@IdBenef = co.IdBeneficiario)
END
GO
